package com.cipe.cmrs.service;

/**
 * @author krishna
 */
import java.util.List;

import javax.persistence.NoResultException;

import org.springframework.stereotype.Service;

import com.cipe.cmrs.model.ActionableAlert;
import com.cipe.cmrs.model.Audits;
@Service
public class ActionableAlertService extends BaseService<ActionableAlert> {
	public List<ActionableAlert> getAllActionableAlert() {
		return this.dao
				.getResultList("SELECT c FROM ActionableAlert c order by c.type ");
	}
	
	public ActionableAlert getActionableAlert(final String type) {
		String sqlQuery = "FROM ActionableAlert WHERE type = ?";	
		ActionableAlert actionableAlert = null;
		try {
			actionableAlert = this.dao.getSingleResult(sqlQuery, new Object[] { type });
		} catch (NoResultException nre) {
			logger.error(nre.getMessage(), nre);
		}
		return actionableAlert;
		
	}	
}
